package org.farng.mp3.id3;

import org.farng.mp3.InvalidTagException;
import org.farng.mp3.object.ObjectBooleanByte;
import org.farng.mp3.object.ObjectNumberFixedLength;

import java.io.IOException;


/**
 * Title: Description: Copyright:    Copyright (c) 2002 Company:
 *
 * @author Eric Farng
 * @version $Revision: 1.5 $
 */
public class FrameBodyRBUF extends AbstractID3v2FrameBody {
    /**
     * Creates a new FrameBodyRBUF object.
     */
    public FrameBodyRBUF() {
        //        this.setObject("Buffer Size", new Byte((byte) 0));
        //        this.setObject("Embedded Info Flag", new Boolean(false));
        //        this.setObject("Offset to Next Flag", new Byte((byte) 0));
    }

    public FrameBodyRBUF(FrameBodyRBUF body) {
        super(body);
    }

    /**
     * Creates a new FrameBodyRBUF object.
     *
     * @param bufferSize DOCUMENT ME!
     * @param embeddedInfoFlag DOCUMENT ME!
     * @param offsetToNextTag DOCUMENT ME!
     */
    public FrameBodyRBUF(byte bufferSize, boolean embeddedInfoFlag, byte offsetToNextTag) {
        this.setObject("Buffer Size", new Byte(bufferSize));
        this.setObject("Embedded Info Flag", new Boolean(embeddedInfoFlag));
        this.setObject("Offset to Next Flag", new Byte(offsetToNextTag));
    }

    /**
     * Creates a new FrameBodyRBUF object.
     *
     * @param file DOCUMENT ME!
     *
     * @throws IOException DOCUMENT ME!
     * @throws InvalidTagException DOCUMENT ME!
     */
    public FrameBodyRBUF(java.io.RandomAccessFile file)
                  throws IOException, InvalidTagException {
        this.read(file);
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public String getIdentifier() {
        return "RBUF";
    }

    /**
     * DOCUMENT ME!
     */
    protected void setupObjectList() {
        objectList.add(new ObjectNumberFixedLength("Buffer Size", 3));
        objectList.add(new ObjectBooleanByte("Embedded Info Flag", (byte) 1));
        objectList.add(new ObjectNumberFixedLength("Offset to Next Tag", 4));
    }
}